package com.sx.zongzhi.presenter;

import android.content.Context;

import com.sx.zongzhi.bean.EconomicOrganizionBean;
import com.sx.zongzhi.modle.ApiManager;
import com.sx.zongzhi.modle.HeadParamBean;
import com.sx.zongzhi.net.BaseCallBack;
import com.sx.zongzhi.net.BaseResult;
import com.sx.zongzhi.view.EconomicOrganizationDetailView;

import java.util.Map;

/**非公有制经济组织详情
 * Created by admin on 2017/12/8.
 */

public class EconomicOrganizationDetailPest {
    private EconomicOrganizationDetailView economicOrganizationDetailView;

    public EconomicOrganizationDetailPest(EconomicOrganizationDetailView economicOrganizationDetailView) {
        this.economicOrganizationDetailView = economicOrganizationDetailView;
    }

    public void getEconomicOrganizationDetail(Context context,String id){
        Map<String,Object> map = HeadParamBean.getHead(context);
        map.put("id",id);
        new ApiManager().getEconomicOrganizationDetail(map, new BaseCallBack<BaseResult<EconomicOrganizionBean>>() {
            @Override
            public void onSuccess(BaseResult<EconomicOrganizionBean> response) {
                economicOrganizationDetailView.getEconomicOrganizationDetailSuccess(response.data);
            }
            @Override
            public void onFailures(String message) {
                economicOrganizationDetailView.showError(message);
            }
        });
    }

    public void deleteEconomicOrganization(Context context,String id){
        Map<String,Object> map = HeadParamBean.getHead(context);
        map.put("id",id);
        new ApiManager().deleteEconomicOrganization(map, new BaseCallBack<BaseResult<Boolean>>() {
            @Override
            public void onSuccess(BaseResult<Boolean> response) {
                economicOrganizationDetailView.deleteEconomicOrganizationDetailSuccess(response.data);
            }
            @Override
            public void onFailures(String message) {
                economicOrganizationDetailView.showError(message);
            }
        });
    }
}
